In computer network communication, a packet loss recovery algorithm plays a very significant role. The packet loss recovery algorithm is an important algorithm that ensures reliability of data transmission in a transmission control protocol (TCP) stack, is an error tolerance mechanism when a data packet is lost, and directly affects data transmission efficiency and utilization of a network bandwidth. RFC2581 defines and describes a typical packet loss recovery algorithm, mainly including timeout retransmission and fast retransmission. Timeout retransmission is an important mechanism for ensuring data reliability in the TCP protocol. A principle of timeout retransmission is: A sending node enables a timeout timer after sending a packet, and after the timeout timer expires, if the sending node still does not receive an acknowledgement packet (ACK for short) indicating that the packet has been correctly received, the sending node resends the packet. The re-sent packet is also generally referred to as a retransmitted packet. Fast retransmission is an optimized mechanism of timeout retransmission. If a transmit end receives more than N (generally, N is equal to 3) repeated ACKs, it is determined that a packet is lost, and the lost packet is retransmitted immediately. In the fast retransmission mechanism, packet retransmission can be performed before a retransmission timer expires, thereby greatly improving the data transmission efficiency.
Avoiding unnecessary timeout retransmission in TCP transmission is always a research hotspot in the academic circles and the industrial circles. However, in most of current TCP protocol stacks, there is no mechanism for detecting loss of a retransmitted packet. If a retransmitted packet is lost, timeout retransmission occurs inevitably, and consequently, the transmission efficiency of a TCP connection is greatly reduced.
Currently, algorithms related to loss detection and recovery of a retransmitted packet mainly include a duplicate acknowledgement counting (DAC) algorithm and a selective acknowledgment plus (SACK+) algorithm. Both the DAC algorithm and the SACK+ algorithm are asymmetric TCP acceleration algorithms, and need to be deployed only at a transmit end, and basic ideas of them are very similar.
A main principle of the DAC algorithm is as follows: When a packet is retransmitted, the transmit end estimates a quantity n of packets currently transmitted in a network, and counts a quantity of repeated ACKs received after packet retransmission, where a packet that is already sent, that is not acknowledged by a receive end, and that is not determined by the transmit end as a lost packet is defined as a packet that is being transmitted in a network; and if a cumulative acknowledgment is not updated after more than n ACKs are received, determines that a currently retransmitted packet is lost, and immediately retransmits the packet again without waiting for timeout retransmission.
As shown in FIG. 1, it is assumed that in a send window, a packet whose sequence number is 3 is lost. As shown in step 101 in FIG. 1, after receiving three repeated ACKs, a transmit end starts fast retransmission to retransmit the packet whose sequence number is 3, and estimates, by using the DAC algorithm, a quantity of packets that are being transmitted in the network. A feasible estimation method is as follows (it should be noted that an estimation method is not limited to this estimation method): The transmit end learns that a largest sequence number of sent packets is 8, a sequence number of a received cumulative acknowledgment is 2, and three repeated acknowledgements are received, the transmit end determines that one packet is lost, and estimates that a quantity of packets that are being transmitted in the network is equal to 8−2−3−1=2. Then, as shown in step 102 in FIG. 1, the transmit end counts received repeated ACKs after retransmission. When the transmit end receives the third repeated ACK after retransmission, if the sequence number of the cumulative acknowledgment is still 2 and is not updated, the transmit end determines that the retransmitted packet is lost. Finally, as shown in step 103 in FIG. 1, the transmit end immediately retransmits the packet whose sequence number is 3 and does not need to wait for timeout of the retransmission timer, thereby avoiding entering timeout retransmission.
A principle of the SACK+ algorithm is similar to that of the DAC algorithm. A main difference is that in the SACK+ algorithm, it is determined, by using selection acknowledgement information carried in a SACK option in an acknowledgement packet, whether a retransmitted packet is lost.
However, it is found through testing that regardless of the DAC algorithm or the SACK+ algorithm, a probability that loss of a retransmitted packet cannot be detected in time is large. As a result, the retransmitted packet cannot be detected and recovered by the transmit end in time after being lost. Consequently, timeout retransmission is triggered. In a scenario of a high packet loss rate, frequent timeout retransmission causes an increase in a transmission delay and a sharp decrease in a transmission rate.